public class Subset {
	public static void main(String[] args)
	{
//		StdOut.println("args.length="+args.length);
		if(args.length != 1)
			throw new java.lang.IllegalArgumentException();
		int N = 0;
		int k = Integer.parseInt(args[0]);
		if(k<0)
			throw new java.lang.IllegalArgumentException();
		String tmpIn = StdIn.readLine();
//		StdOut.println("tmpin="+tmpIn);
		String[] tmpIns;
		tmpIns = tmpIn.split(" ");
		N = tmpIns.length;
		if(k>N)
			throw new java.lang.IllegalArgumentException();

		RandomizedQueue<String> queue = new RandomizedQueue<String>();
		for(int i=0; i<N; i++)
			queue.enqueue(tmpIns[i]);
		
		while(k>0)
		{
			StdOut.println(queue.dequeue());
			k--;
		}
	}
}